<template>
    <div class="page">
        <div class="crumbs">
            <el-breadcrumb separator="/">
                <el-breadcrumb-item><i class="el-icon-lx-tag"></i> 查看学生</el-breadcrumb-item>
            </el-breadcrumb>
        </div>
        <div class="container">
            
            <el-table :data="students" border class="table" ref="multipleTable" header-cell-class-name="table-header">
                <el-table-column prop="student_id" label="学号" width="180" align="center"></el-table-column>
                <el-table-column prop="student_name" label="姓名"></el-table-column>
                <el-table-column prop="student_major" label="专业"></el-table-column>
                
                <el-table-column prop="remark" label="备注"></el-table-column>
            </el-table>
        </div>
    </div>
</template>

<script>
import { postRequest, getRequest } from '../../api';
export default {
    name: 'ViewStudent',
    components: {},
    data() {
        return {
            courseId: '',
            currentPage: 1,
            itemOfPage: 10,
            totalPages: 0,
            students: []
        };
    },
    created() {
        if (this.$route.query.courseId) {
            this.courseId = this.$route.query.courseId;
            this.getStudent();
        } else {
            this.$message.error('您还未指定课程, 请前往成绩录入页面!');
        }
    },
    methods: {
        getStudent() {
            getRequest(
                '/login/teacher/grade/get_studnet_grade',
                { course_id: this.courseId, current_page: this.currentPage, itemsofpage: this.itemOfPage },
                global.CONTENT_TYPE_URLENCODED
            ).then(
                res => {
                    if (res.code == 200) {
                        this.students = res.data.content;
                        this.totalPages = res.data.total_pages;
                    }
                },
                err => {}
            );
        }
    }
};
</script>

<style scoped>
</style>
